Skip to main content
PUT
/
api
/
pedidos
/
{id}
Update Order
curl --request PUT \
  --url https://api.example.com/api/pedidos/{id}
Updates an existing order. Typically used to change order status or modify line items.

Authentication

Requires JWT token in the Authorization header.
Authorization: Bearer YOUR_JWT_TOKEN

Path Parameters

ParameterTypeRequiredDescription
idLongYesOrder ID to update

Request Body

Send a complete PedidoDetalleDTO object with updated values.
{
  "usuario": {
    "usuario_id": 5
  },
  "estado": "ENVIADO",
  "detalles": [
    {
      "detalle_id": 101,
      "producto": {
        "producto_id": 10
      },
      "cantidad": 2,
      "precioUnitario": 49.99
    },
    {
      "detalle_id": 102,
      "producto": {
        "producto_id": 15
      },
      "cantidad": 1,
      "precioUnitario": 129.99
    }
  ]
}

Request Fields

FieldTypeRequiredDescription
usuario.usuario_idLongYesUser ID
estadoStringYesUpdated order status
detallesArrayYesArray of order line items
detalles[].detalle_idLongNoLine item ID (for existing items)
detalles[].producto.producto_idLongYesProduct ID
detalles[].cantidadIntegerYesQuantity
detalles[].precioUnitarioBigDecimalYesUnit price

EstadoPedido Values

  • PENDIENTE - Order pending
  • PAGADO - Order paid
  • ENVIADO - Order shipped
  • ENTREGADO - Order delivered
  • CANCELADO - Order cancelled

Response

Returns the updated order object.

Response Body

{
  "pedido_id": 42,
  "referencia": "ORD-2026-042",
  "usuario": {
    "usuario_id": 5,
    "username": "john_doe",
    "email": {
      "address": "john@example.com"
    }
  },
  "fechaPedido": "2026-03-11T14:22:35",
  "estado": "ENVIADO",
  "detalles": [
    {
      "detalle_id": 101,
      "producto": {
        "producto_id": 10,
        "nombre": "BILLY Bookcase",
        "precioCantidad": 49.99,
        "precioMoneda": "USD",
        "es_destacado": false
      },
      "cantidad": 2,
      "precioUnitario": 49.99,
      "subtotal": 99.98
    },
    {
      "detalle_id": 102,
      "producto": {
        "producto_id": 15,
        "nombre": "MALM Dresser",
        "precioCantidad": 129.99,
        "precioMoneda": "USD",
        "es_destacado": true
      },
      "cantidad": 1,
      "precioUnitario": 129.99,
      "subtotal": 129.99
    }
  ],
  "total": 229.97
}

Example Request

curl -X PUT "https://api.iquea.com/api/pedidos/42" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "usuario": {
      "usuario_id": 5
    },
    "estado": "ENVIADO",
    "detalles": [
      {
        "detalle_id": 101,
        "producto": {
          "producto_id": 10
        },
        "cantidad": 2,
        "precioUnitario": 49.99
      }
    ]
  }'

Status Codes

CodeDescription
200Success - Order updated
400Bad request - Invalid order data
401Unauthorized - Invalid or missing token
404Order not found
500Internal server error